/**
 * @file categories/binary_tree/preorder/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/8 12:26:24
 **/

#include <bits/stdc++.h>
using namespace std;
int tree[30][2];
char buf[5];
void preorder(int root) {
  putchar(root + 'a');
  for (int i = 0; i <= 1; ++i)
    if (tree[root][i] != -1) preorder(tree[root][i]);
}
int main() {
  // High rating and good luck!
  int n;
  cin >> n;
  memset(tree, 0xff, sizeof(tree));
  int root = -1;
  for (int i = 0; i < n; ++i) {
    cin >> buf;
    if (root == -1) root = buf[0] - 'a';
    for (int j = 0; j < 3; ++j)
      if (buf[j] != '*')
        buf[j] -= 'a';
      else
        buf[j] = -1;
    tree[(int)buf[0]][0] = buf[1];
    tree[(int)buf[0]][1] = buf[2];
  }
  preorder(root);
  return 0;
}
